package com.imu.purse.modules.base.dao;

import java.util.List;
import org.apache.ibatis.annotations.Select;

import com.imu.core.base.BaseMapper;
import com.imu.purse.modules.base.entity.Dict;

/**
 * 字典分组
 * @author sunhongwei
 * @email sunhongwei@jshijian.com
 * @date 2017-11-03 20:34:20
 * Copyright (c) 2017 武汉极时间科技有限公司 版权所有 
 * Jshijian aloha CO.,LTD. All Rights Reserved. 
 */
public interface DictMapper extends BaseMapper<Dict>
{
	/**
     * 分页查询
     * @param pageNo 页号
     * @param pageSize 每页显示记录数
     * @return
     */
	@Select({
		"<script>",
		    "SELECT id,",
					"name,",
					"code,",
					"remarks,",
					"cid,",
					"cs,",
					"mid,",
					"ms,",
					"del_flag",
		    "FROM sys_dict ",
		    "WHERE 1 = 1",
			"<when test = 'name != null'>",
		    	"AND `name` = #{name}",
		    "</when>",
			"<when test = 'code != null'>",
		    	"AND `code` = #{code}",
		    "</when>",
			"<when test = 'remarks != null'>",
		    	"AND `remarks` = #{remarks}",
		    "</when>",
			"<when test = 'cid != null'>",
		    	"AND `cid` = #{cid}",
		    "</when>",
			"<when test = 'cs != null'>",
		    	"AND `cs` = #{cs}",
		    "</when>",
			"<when test = 'mid != null'>",
		    	"AND `mid` = #{mid}",
		    "</when>",
			"<when test = 'ms != null'>",
		    	"AND `ms` = #{ms}",
		    "</when>",
		    "<when test = 'stime != null'>",
		    	"AND cs &gt;= #{stime}",
		    "</when>",
		    "<when test = 'etime != null'>",
				"AND cs &lt;= #{etime}",
			"</when>",
		    "ORDER BY cs DESC",
    	"</script>"
	})
    public List<Dict> findByPage(final Dict entity);	
}
